*===============================================================================
* Title: Two Levels - Attitudes
* Author: Agatha, Alex
*===============================================================================


*** candidates national level
foreach x of numlist $all  {
	gen B_candcdu`x' = (kp`x'_650a-1)/10
	gen B_candspd`x' = (kp`x'_650z-1)/10
	gen B_candfdp`x' = (kp`x'_650s-1)/10
	gen B_candgru`x' = (kp`x'_650w-1)/10
	gen B_candlin`x' = (kp`x'_650y-1)/10
	gen B_candafd`x' = (kp`x'_650x-1)/10
	replace B_candcdu`x' 	=	.p	if kp`x'_650a	==	.p
	replace B_candspd`x' 	=	.p	if kp`x'_650z	==	.p
	replace B_candfdp`x' 	=	.p	if kp`x'_650s	==	.p
	replace B_candgru`x' 	=	.p	if kp`x'_650w	==	.p
	replace B_candlin`x' 	=	.p	if kp`x'_650y	==	.p
	replace B_candafd`x' 	=	.p	if kp`x'_650x	==	.p
}

*** candidates regional level
foreach x of numlist $all  {
	gen L_candcdu`x' 		= (kp`x'_650e1-1)/10
	replace L_candcdu`x' 	=	.p	if kp`x'_650e1	==	.p
	gen L_candspd`x' 		= (kp`x'_650d1-1)/10
	replace L_candspd`x' 	=	.p	if kp`x'_650d1	==	.p
	gen L_candfdp`x' 		= (kp`x'_650f1-1)/10
	replace L_candfdp`x' 	=	.p	if kp`x'_650f1	==	.p
	gen L_candgru`x' 		= (kp`x'_650g1-1)/10
	replace L_candgru`x' 	=	.p	if kp`x'_650g1	==	.p
	gen L_candlin`x' 		= (kp`x'_650h1-1)/10
	replace L_candlin`x' 	=	.p	if kp`x'_650h1	==	.p
}
	gen L_candafd9 		= (kp9_650k1-1)/10 // AfD nur in Welle 18!
replace L_candafd9 	=	.p	if kp9_650k1	==	.p

	
*** candidates CDU and SPD categorial with don't know-option
foreach x of numlist $all  {
	recode kp`x'_650e1 (1/5=1) (6=2) (7/11=3) (.p=0), gen(L_candcduKAT`x')
	recode kp`x'_650d1 (1/5=1) (6=2) (7/11=3) (.p=0), gen(L_candspdKAT`x')
lab var kp`x'_650e1 "Bewertung Bernd Althusmann"
lab var kp`x'_650d1 "Bewertung Stephan Weil"
lab def candkat 0 "nicht bekannt" 1 "negativ" 2 "neutral" 3 "positiv", modify
lab val L_candcduKAT`x' L_candspdKAT`x' candkat
}


*** evaluation parties
foreach x of numlist $all  {
	gen B_scalcdu`x' = (kp`x'_430a-1)/10
	gen B_scalspd`x' = (kp`x'_430c-1)/10
	gen B_scalfdp`x' = (kp`x'_430d-1)/10
	gen B_scalgru`x' = (kp`x'_430e-1)/10
	gen B_scallin`x' = (kp`x'_430f-1)/10
	gen B_scalafd`x' = (kp`x'_430i-1)/10
}



*** evaluation performance regional parties
foreach x of numlist $all  {
	gen L_scalspd`x' = (kp`x'_3243a-1)/10
	gen L_scalgru`x' = (kp`x'_3243b-1)/10
	gen L_scalcdu`x' = (kp`x'_3244a-1)/10
	gen L_scalfdp`x' = (kp`x'_3244b-1)/10
}


*** evaluation toward one's own vote choice
clonevar	L_scalvote9	=	L_scalcdu9 if NIwahl9 == 1
replace		L_scalvote9	=	L_scalspd9 if NIwahl9 == 4
replace		L_scalvote9	=	L_scalfdp9 if NIwahl9 == 5
replace		L_scalvote9	=	L_scalgru9 if NIwahl9 == 6

clonevar	B_scalvote9	=	B_scalcdu9 if NIwahl9 == 1
replace		B_scalvote9	=	B_scalspd9 if NIwahl9 == 4
replace		B_scalvote9	=	B_scalfdp9 if NIwahl9 == 5
replace		B_scalvote9	=	B_scalgru9 if NIwahl9 == 6
replace		B_scalvote9	=	B_scallin9 if NIwahl9 == 7
replace		B_scalvote9	=	B_scalafd9 if NIwahl9 == 322

clonevar	L_candvote9	=	L_candcdu9 if NIwahl9 == 1
replace		L_candvote9	=	L_candspd9 if NIwahl9 == 4
replace		L_candvote9	=	L_candfdp9 if NIwahl9 == 5
replace		L_candvote9	=	L_candgru9 if NIwahl9 == 6
replace		L_candvote9	=	L_candlin9 if NIwahl9 == 7
replace		L_candvote9	=	L_candafd9 if NIwahl9 == 322

clonevar	B_candvote9	=	B_candcdu9 if NIwahl9 == 1
replace		B_candvote9	=	B_candspd9 if NIwahl9 == 4
replace		B_candvote9	=	B_candfdp9 if NIwahl9 == 5
replace		B_candvote9	=	B_candgru9 if NIwahl9 == 6
replace		B_candvote9	=	B_candlin9 if NIwahl9 == 7
replace		B_candvote9	=	B_candafd9 if NIwahl9 == 322
